/*
 * $RCSfile: Schema.java,v $
 * $Revision: 1.4 $
 *
 * Comments:
 *
 * (C) Copyright Biuro-Technika 2007.  All rights reserved.
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF Biuro-Technika
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 *
 * $Author: michal $          $Locker:  $
 * $Date: 2010/05/24 10:44:09 $
 * $Log: Schema.java,v $
 * Revision 1.4  2010/05/24 10:44:09  michal
 * parametryzacja kodu
 *
 * Revision 1.3  2010/02/16 15:22:02  michal
 * dodanie toString
 *
 * Revision 1.2  2007/08/24 09:12:49  dominik
 * Dodanie nowych konstruktorow
 *
 * Revision 1.1  2007/08/21 09:21:53  dominik
 * Reprezentacja Schemy
 *
 */

package parasoft.centrap.migration;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.Vector;

public class Schema {
	private long oid;
	private String schema_name;
	private Vector<Table> tables;
	
	public Schema(long _oid, String name) {
		this.oid = _oid;
		this.schema_name = name;
		this.tables = new Vector<Table>();
	}
	
	public Schema(String name) {
		this.schema_name = name;
		this.tables = new Vector<Table>();
	}
		
	public void addTable(Table table){
		tables.add(table);
	}


	public long getOid() {
		return oid;
	}


	public String getSchemaName() {
		return schema_name;
	}


	public Vector<Table> getTables() {
		return tables;
	}
	
	public Table getTable(String tableName) {
		for (Iterator<Table> iter = tables.iterator(); iter.hasNext();) {
			Table table = iter.next();
			if (table.getTableName().equals(tableName) ){
				return table;
			}
		}
		return null;
	}
	
	public void wypisz(){
		for(Enumeration<Table> e = tables.elements(); e.hasMoreElements();){
			Table t = e.nextElement();
			if(schema_name.equals("etos") && t.getTableName().equals("towary")){
				System.out.println(schema_name+"  "+t.getTableName());
				t.wypisz();
			}
		}
	}
	
	public String toString() {
		return schema_name;
	}
}
